<template>
	<view>
		<view style="width: 97%; padding: 0rpx 10rpx 0rpx 10rpx;">
			<view v-html="article"></view>
		</view>
	</view>
</template>

<script>
	//import uParse from '@/components/uParse/src/wxParse.vue'
	export default {
		components: {
			//uParse
		},
		data() {
			return {
				title: '详情',
				article: '准备中...',
				newsTitle: '',
				newsId: ''
			}
		},
		onLoad(options) {
			// console.log(options.newsId); //打印出上个页面传递的参数。
			this.newsId = options.newsId
			// console.log(this.apiSrver);
			uni.request({
				url:'https://www.hngsxy.com/mybatisplus/gsxyNews/gsxyNewsOne',
				data:{
					newsId: this.newsId
				},
				success: (res) => {
					this.article = res.data.newsContext
					this.newsTitle = res.data.newsTitle
				},
				fail: (res) => {
					console.log("未知错误");
				}
			})
			this.gsxyNewsCuntAdd(this.newsId)
		},
		methods: {
			preview(src, e) {
				// do something
				console.log("src: " + src);
			},
			navigate(href, e) {
				// 如允许点击超链接跳转，则应该打开一个新页面，并传入href，由新页面内嵌webview组件负责显示该链接内容
				console.log("href: " + href);
				uni.showModal({
					content : "点击链接为：" + href,
					showCancel:false
				})
			},
			gsxyNewsCuntAdd(id) {
				uni.request({
					url:'https://www.hngsxy.com/mybatisplus/gsxyNews/gsxyNewsCuntAdd',
					data:{
						newsId: id
					},
					success: (res) => {
						// console.log(res.data)
					},
					fail: (res) => {
						console.log("未知错误");
					}
				})
			},onShareAppMessage(res) {
				let str1 = '/pages_bd/details/details?newsId=' + this.newsId
				console.log(str1)
				return {
					title: this.newsTitle,
					path: str1,
					imageUrl:'http://www.hngsxy.com/projectresources/newgsxy/wxxcxlogo1.jpg'
				}
			},onShareTimeline(res){
				let str2 = '/pages_bd/details/details?newsId=' + this.newsId
				console.log(str2)
				return {
					title: this.newsTitle,
					path: str2,
					imageUrl:'http://www.hngsxy.com/projectresources/newgsxy/wxxcxlogo1.jpg'
				}
			}
		}
	}
</script>

<style>
	/* @import url("../../components/uParse/src/wxParse.css"); */
</style>